﻿<Window x:Class="cmdr.Editor.Views.EffectIdentificationWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converters="clr-namespace:cmdr.Editor.Converters"
        xmlns:behaviors="clr-namespace:cmdr.WpfControls.Behaviors;assembly=cmdr.WpfControls"
        Title="{Binding Title, Mode=OneWay}" Height="325" Width="350" ResizeMode="NoResize" WindowStartupLocation="CenterOwner"
        behaviors:WindowBehavior.CanUserClose="False">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisConverter"/>
        <converters:EnumMatchToBooleanConverter x:Key="enumConverter" />
    </Window.Resources>
    <Window.InputBindings>
        <KeyBinding Key="Escape" Command="{Binding CloseCommand, Mode=OneTime}"/>
        <KeyBinding Key="Enter" Command="{Binding OkCommand, Mode=OneTime}"/>
        <KeyBinding Key="Up" Command="{Binding SelectPreviousCommand, Mode=OneTime}"/>
        <KeyBinding Key="Down" Command="{Binding SelectNextCommand, Mode=OneTime}"/>
    </Window.InputBindings>
    <Grid Margin="20">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="20"/>
            <RowDefinition/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" FontWeight="Bold" Text="The TSI file you want to load uses effects but does not identify them.&#x0a;&#x0a;Please chose how to solve this problem:" TextWrapping="Wrap"/>
    
        <StackPanel Grid.Row="2">
            <RadioButton GroupName="options" Margin="0,0,0,10" IsEnabled="{Binding CanUseTraktorSettings}"
                          IsChecked="{Binding Path=CurrentOption, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Option1}">
                <TextBlock TextWrapping="Wrap">Use Traktor Settings</TextBlock>
            </RadioButton>
            <RadioButton GroupName="options" x:Name="rbTsi" Margin="0,0,0,10" 
                         IsChecked="{Binding Path=CurrentOption, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Option2}">
                <StackPanel>
                    <TextBlock>Use another TSI file</TextBlock>
                    <Grid VerticalAlignment="Center" Visibility="{Binding ElementName=rbTsi, Path=IsChecked, Converter={StaticResource boolToVisConverter}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Border BorderThickness="1,1,0,1" BorderBrush="LightGray" Height="20">
                            <TextBlock x:Name="tbPathToTsi" Text="{Binding PathToTsi, Mode=TwoWay}" 
                               VerticalAlignment="Center" />
                        </Border>
                        <Button Grid.Column="1" Width="20" Height="20" Content="..." Command="{Binding BrowseFileCommand, Mode=OneWay}" CommandParameter="{Binding ElementName=tbPathToTsi}"/>
                    </Grid>
                </StackPanel>
            </RadioButton>
            <RadioButton GroupName="options" Margin="0,0,0,10"
                         IsChecked="{Binding Path=CurrentOption, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Option3}">
                <TextBlock TextWrapping="Wrap">Just keep them as they are. I won't change any effect related stuff and don't mind that wrong effects are displayed (default).</TextBlock>
            </RadioButton>
        </StackPanel> 
        
        <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Width="100" Margin="0,0,20,0" Content="Ok" Command="{Binding OkCommand, Mode=OneTime}" />
        </StackPanel>

        <TextBlock Grid.Row="3" VerticalAlignment="Bottom" HorizontalAlignment="Right">
            <Hyperlink NavigateUri="https://cmdr.codeplex.com/wikipage?title=Effects" RequestNavigate="hyperlink_RequestNavigate">Help</Hyperlink>
        </TextBlock>
    </Grid>
</Window>
